home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2003 November / PCWK1103B.iso / CINEMA 4D CE 6 / Libs / gemodaldialog.cox < prev    next >
Text File  |  2000-07-09  |  904b  |  66 lines

  1. class GeModalDialog : GeDialog
  2. {
  3.     private:
  4.         var dlg_result;
  5.  
  6.     public:
  7.         GeModalDialog();
  8.  
  9.         Message(msg);
  10.         Open(xpos,ypos);
  11.  
  12.         GetResult();
  13. }
  14.  
  15. GeModalDialog::GetResult()
  16. {
  17.     return dlg_result;
  18. }
  19.  
  20. GeModalDialog::Message(msg)
  21. {
  22.     switch (msg->GetId())
  23.     {
  24.         case BFM_CHECKCLOSE:
  25.             if (dlg_result && _AddGadget(DIALOG_CHECKNUMBERS,0,"",0,0,0,0))
  26.             {
  27.                 dlg_result = FALSE;
  28.                 return TRUE;
  29.             }
  30.             return FALSE;
  31.  
  32.         case BFM_ASKCLOSE:
  33.             if (AskClose()) return TRUE;
  34.             break;
  35.  
  36.         case BFM_ACTION:
  37.         {
  38.             var id = msg->GetInt(BFM_ACTION_ID);
  39.             var res = Command(id,msg);
  40.  
  41.             if (id == IDC_OK || id == IDC_CANCEL)
  42.             {
  43.                 dlg_result = (id==IDC_OK);
  44.                 Close();
  45.             }
  46.             return res;
  47.         }
  48.         break;
  49.     }
  50.     return super::Message(msg);
  51. }
  52.  
  53. GeModalDialog::GeModalDialog()
  54. {
  55.     super(0);
  56.     dlg_result = FALSE;
  57. }
  58.  
  59. GeModalDialog::Open(xpos,ypos)
  60. {
  61.     dlg_result = FALSE;
  62.     super::Open(FALSE,xpos,ypos);
  63.     return dlg_result;
  64. }
  65.  
  66.